<template>
  <div :class="{tablemode:fullScreen}">
    <div v-if="fullScreen" class="closefull">
      <a-button style="margin-bottom: 10px" @click="closescreen"> 退出全屏 </a-button>
    </div>
    <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="model"
        :loading="confirmLoading"
        class="j-table-force-nowrap"
        :pagination="false"
        >
      </a-table>
  </div>
</template>

<script>

  import { getAction } from '@/api/manage'
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import {DisabledAuthFilterMixin} from '@/mixins/DisabledAuthFilterMixin'

  export default {
    name: 'ErpModelManagementModal',
    mixins: [JeecgListMixin, DisabledAuthFilterMixin],
    components: {
    },
    props: {
      // 全屏控制
      fullScreen: {
        type: Boolean,
        default: false,
      },
    },
    data () {
      return {
        model: [],
        id: '',
        url: {
          queryTable: "/api/erp/hr/payment/erpRemunerationCategoryDefinition/previewPay",
        },
        confirmLoading: false,
        iconStyle:{"font-size":"20px"},
        columns: [],
        // 列定义
        defColumns: [
          {
            title:'基础工资',
            align:"center",
            dataIndex: 'basePay',
            width: 100,
          },
          {
            title:'年功工资（元）',
            align:"center",
            dataIndex: 'seniorityWage',
            width: 100,
          },
          {
            title:'等级工资（元）',
            align:"center",
            dataIndex: 'gradedWages',
            width: 100,
          },
          {
            title:'预发绩效',
            align:"center",
            dataIndex: 'advancePerformance',
            width: 100,
          },
          {
            title:'执业金（元）',
            align:"center",
            dataIndex: 'executiveFund',
            width: 100,
          },
          {
            title:'报告审核费',
            align:"center",
            dataIndex: 'reportApplicationFee',
            width: 100,
          },
          {
            title:'项目绩效',
            align:"center",
            dataIndex: 'projectPerformance',
            width: 100,
          },
          {
            title:'前期已结算',
            align:"center",
            dataIndex: 'settledThePreviousPeriod',
            width: 100,
          },
          {
            title:'缺勤扣款',
            align:"center",
            dataIndex: 'absenceDeduction',
            width: 100,
          },
          {
            title:'其它',
            align:"center",
            dataIndex: 'other',
            width: 100,
          },
          {
            title:'其他扣款（元）',
            align:"center",
            dataIndex: 'otherDeductions',
            width: 100,
          },
          {
            title:"应发工资",
            align:"center",
            dataIndex: 'grossPay',
            width: 100,
          },
          {
            title: new Date().getFullYear() + '年累计收入',
            align:"center",
            dataIndex: 'annualCumulativeIncome',
            width: 100,
          },
          {
            title:'下月社保',
            align:"center",
            dataIndex: 'insuranceForNextMonth',
            width: 100,
          },
          {
            title:'当月公积金',
            align:"center",
            dataIndex: 'monthBond',
            width: 100,
          },
          {
            title:new Date().getFullYear() + '年五险一金累计扣款',
            align:"center",
            dataIndex: 'yearFiveInsurancesCount',
            width: 100,
          },
          {
            title:new Date().getFullYear() + '年累计个税专项附加扣除金额',
            align:"center",
            dataIndex: 'yearSpecialCount',
            width: 100,
          },
          {
            title:new Date().getFullYear() + '年应预缴个人所得税',
            align:"center",
            dataIndex: 'yearAdvanceCount',
            width: 100,
          },
          {
            title:new Date().getFullYear() + '年已预缴个人所得税金额',
            align:"center",
            dataIndex: 'yearPaidIndividualCount',
            width: 100,
          },
          {
            title:'本期应预缴个人所得税',
            align:"center",
            dataIndex: 'currentDuePersonal',
            width: 100,
          },
          {
            title:'前期已发放',
            align:"center",
            dataIndex: 'previouslyIssued',
            width: 100,
          },
          {
            title:'实发工资（元）',
            align:"center",
            dataIndex: 'netPayment',
            width: 100,
          }
        ],
      }
    },
    created() {
      this.columns = this.defColumns
    },
    methods: {
      closescreen() {
        this.$emit('closefullScreen')
      },
      loadData(importDefinitionCategory) {
        if (importDefinitionCategory) {
          this.confirmLoading = true
          this.model = []
          const that = this
          getAction(this.url.queryTable, { importDefinitionCategory }).then((res) => {
            if (res.success) {
              res.result.id = '1'
              const map = res.result.tableMap
              if(map){
                let columnList = []
                for(const key in map){
                  columnList.push(
                    {
                      title:key,
                      align:"center",
                      dataIndex: map[key],
                      width: 100
                    }
                  )
                }
                that.columns = columnList
                that.model.push(res.result)
              }
            } else {
              that.$message.warning(res.message);
            }
          }).finally(() => {
            that.confirmLoading = false;
          })
        } else {
          this.columns = this.defColumns
          this.model = []
        }
      },
    }
  }
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';

.info {
  /deep/ .ant-card-head-title{
    flex: none;
    margin-right: 20px;
  }
  /deep/ .ant-card-extra{
    flex: 1;
    float: left;
  }
}
.tablemode {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 30px;
  box-sizing: border-box;
  background: #fff;
  z-index: 99;
}
.closefull {
  display: flex;
  justify-content: flex-end;
}
</style>
